home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / calendar.doc < prev    next >
Text File  |  1995-03-31  |  8KB  |  296 lines

  1.  
  2. ***************************************************************************** 
  3. *         DOCUMENTATION FILE FOR HP48SX CALENDAR DRAWING FUNCTIONS          * 
  4. *                                                                           * 
  5. *                   by Kevin Jessup  October 19th, 1990                     * 
  6. ***************************************************************************** 
  7.  
  8.  
  9. If you have successfully loaded the binary CALENDAR directory file, a 
  10. directory named "CALENDAR" should now be in your current working directory. 
  11. Verify the following... 
  12.  
  13.    Checksum:   # EA4E (hex) or # 59982 (decimal) 
  14.    Byte count: 2449 
  15.  
  16.    Note:       The checksum will change if the day, month or year global 
  17.                variables have been modified since you downloaded the 
  18.                directory! 
  19.  
  20.  
  21. Introduction 
  22. ------------ 
  23. These routines will display a calendar graphic for a specific year and month 
  24. on the 48SX display.  Functions are provided to move the calendar forward 
  25. or backwards in month or year increments.  Day  of week and leap year func- 
  26. tions are also provided. 
  27.  
  28. The CALENDAR directory should contain the following objects in the order 
  29. they appear below.  For ease of use, DO NOT re-order the directory. 
  30. Objects preceeded with an asterisk (*) are described in detail later.  All 
  31. other objects are subroutines used by the main functions and are NOT 
  32. described.  A listing of ALL objects is provided at the end of the 
  33. documentation. 
  34.  
  35. Name       Object type     Purpose 
  36. -------    -----------     -------------------------------------------------- 
  37. * CURR     program         Draws a calendar for the current month. 
  38. * <-Y      program         Draws a calendar for the previous year, same month. 
  39. * Y->      program         Draws a calendar for the next year, same month. 
  40. * <-M      program         Draws a calendar for the previous month, same year. 
  41. * M->      program         Draws a calendar for the next month, same year. 
  42. * PCAL     program         Prints the last calendar dislayed. 
  43. * CAL      program         Given specific month and year, draws the calendar. 
  44. * DOW      program         Returns current day of week string to stack. 
  45. * SDOW     program         Given a date, returns day of week string to stack. 
  46. * RDOW     program         Given a date, returns day of week number to stack. 
  47. * LPYR     program         Given a year, determines if it is a leap year. 
  48. * ALMDATE? program         Given a date, determines if any alarms are due. 
  49.   MOY      list            Months of the year. 
  50.   DIM      list            Number of days in the months. 
  51.   DOWL     list            Days of the week. 
  52.   GENC     program         Main calendar graphic generating function. 
  53.   FILLD    program         Adds days and alarm flags to the calendar graphic. 
  54.   MONTHBOX program         Draws the calendar graphic lines and days of week. 
  55.   CPSDT    program         Compress date and time. 
  56.   EXPDT    program         Expand date and time. 
  57.   JFIX     program         Adjust for date mode. 
  58.   day      real number 
  59.   year     real number 
  60.   month    real number 
  61.   PPAR     list            Plot parameters. 
  62.  
  63.  
  64. Detailed function descriptions 
  65. ------------------------------ 
  66.  
  67. CURR   Draws a calendar for the current month.  A graphic display of the 
  68.        month, year and appropriately positioned day numbers is generated. 
  69.        Days that have an alarm associated with them will contain a box 
  70.        to mark the alarm. 
  71.  
  72. <-Y    Same as CURR but backs up one year. 
  73.  
  74. Y->    Same as CURR but moves forward one year. 
  75.  
  76. <-M    Same as CURR but backs up one month. 
  77.  
  78. M->    Same as CURR but moves forward one month. 
  79.  
  80. PCAL   Prints the current contents of the PICT variable.  If some other 
  81.        program has not deleted PICT or modified it, the object printed 
  82.        should be the last calendar you displayed. 
  83.  
  84. CAL    Given a date on the stack in valid HP48SX date format (MM.DDYYYY or 
  85.        DD.MMYYYY) displays the calendar for the month as in CURR. 
  86.  
  87. DOW    Returns the current day of week text string to the stack. 
  88.  
  89. SDOW   Given a date as in CAL, returns the day of week text string to the 
  90.        stack. 
  91.  
  92. RDOW   Same as SDOW but returns a real number. 
  93.        Sunday = 0, Monday = 1,  ...  Saturday = 6. 
  94.  
  95. LPYR   Given a year on level 1, returns 1 if it is a leap year, else 0. 
  96.  
  97. ALMDATE? 
  98.        Given a date as in CAL, returns 1 if alarms are due on that date, 
  99.        else 0. 
  100.  
  101.  
  102. Warranties and Support 
  103. ---------------------- 
  104. None provided.  Programs are supplied AS IS. 
  105.  
  106.  
  107. Shareware 
  108. --------- 
  109. Please support the HP48SX "shareware" concept by either contributing a few 
  110. bucks to the author (address below) or posting your own USEFULL programs 
  111. on the HP48SX BBS! 
  112.  
  113.                                                    Kevin Jessup 
  114.                                                    9118 N. 85th St. 
  115.                                                    Milwaukee, WI 53224 
  116.  
  117.  
  118. Directory object ASCII listing 
  119. ------------------------------ 
  120. %%HP: T(3)A(D)F(.); 
  121. DIR 
  122.   CURR 
  123.     \<< DATE CAL 
  124.     \>> 
  125.   \<-Y 
  126.     \<< 'year' 1 STO- 
  127. GENCAL 
  128.     \>> 
  129.   Y\-> 
  130.     \<< 'year' 1 STO+ 
  131. GENCAL 
  132.     \>> 
  133.   \<-M 
  134.     \<< 
  135.       IF month 1 - 
  136. DUP 1 < 
  137.       THEN DROP 12 
  138. 'year' 1 STO- 
  139.       END 'month' 
  140. STO GENCAL 
  141.     \>> 
  142.   M\-> 
  143.     \<< 
  144.       IF month 1 + 
  145. DUP 12 > 
  146.       THEN DROP 1 
  147. 'year' 1 STO+ 
  148.       END 'month' 
  149. STO GENCAL 
  150.     \>> 
  151.   PCAL 
  152.     \<< PICT RCL PR1 
  153. DROP 
  154.     \>> 
  155.   CAL 
  156.     \<< EXPDT JFIX 
  157. 'year' STO 'month' 
  158. STO 'day' STO 
  159. GENCAL 
  160.     \>> 
  161.   DOW 
  162.     \<< DATE SDOW 
  163.     \>> 
  164.   SDOW 
  165.     \<< 0 TSTR 1 3 
  166. SUB 
  167.     \>> 
  168.   RDOW 
  169.     \<< SDOW DOWL 
  170. SWAP POS 1 - 
  171.     \>> 
  172.   LPYR 
  173.     \<< \-> y 
  174.       \<< y 4 MOD NOT 
  175. y 100 MOD AND y 400 
  176. MOD NOT OR 
  177.       \>> 
  178.     \>> 
  179.   ALMDATE? 
  180.     \<< 
  181.       IF DUP 
  182. FINDALARM DUP 
  183.       THEN RCLALARM 
  184. 1 GET == 
  185.       ELSE DROP 0 
  186.       END 
  187.     \>> 
  188.   MOY { "JANUARY" 
  189. "FEBRUARY" "MARCH" 
  190. "APRIL" "MAY" 
  191. "JUNE" "JULY" 
  192. "AUGUST" 
  193. "SEPTEMBER" 
  194. "OCTOBER" 
  195. "NOVEMBER" 
  196. "DECEMBER" } 
  197.   DIM { 31 28 31 30 
  198. 31 30 31 31 30 31 
  199. 30 31 } 
  200.   DOWL { "SUN" 
  201. "MON" "TUE" "WED" 
  202. "THU" "FRI" "SAT" } 
  203.   GENCAL 
  204.     \<< { # 0d # 0d } 
  205. PVIEW MONTHBOX MOY 
  206. month GET " " + 
  207. year \->STR + 1 \->GROB 
  208. DUP SIZE DROP 
  209. # 131d SWAP - # 2d 
  210. / # 2d 2 \->LIST PICT 
  211. SWAP ROT REPL 
  212. FILLDAYS 7 FREEZE 
  213.     \>> 
  214.   FILLDAYS 
  215.     \<< 1 month year 
  216. JFIX CPSDT RDOW 0 1 
  217. DIM month GET 
  218.       IF month 2 == 
  219. year LPYR AND 
  220.       THEN 1 + 
  221.       END 
  222.       FOR d PICT 3 
  223. PICK R\->B # 18d * 
  224. # 6d + 3 PICK R\->B 
  225. # 8d * # 16d + 2 
  226. \->LIST d \->STR d 
  227. month year JFIX 
  228. CPSDT 
  229.         IF ALMDATE? 
  230.         THEN 1 CHR 
  231.         END 1 \->GROB 
  232. REPL SWAP 
  233.         IF 1 + DUP 
  234. 6 > 
  235.         THEN DROP 0 
  236. SWAP 1 + SWAP 
  237.         END SWAP 
  238.       NEXT DROP2 
  239.     \>> 
  240.   MONTHBOX 
  241.     \<< # 131d # 62d 
  242. BLANK PICT STO { 
  243. # 2d # 0d } { 
  244. # 128d # 0d } LINE 
  245. { # 2d # 0d } { 
  246. # 2d # 61d } LINE { 
  247. # 128d # 0d } { 
  248. # 128d # 61d } LINE 
  249. # 14d 1 7 
  250.       START # 2d 
  251. OVER 2 \->LIST OVER 
  252. # 128d SWAP 2 \->LIST 
  253. LINE # 8d + 
  254.       NEXT DROP 
  255. # 20d 1 6 
  256.       START DUP 
  257. # 15d 2 \->LIST OVER 
  258. # 62d 2 \->LIST LINE 
  259. # 18d + 
  260.       NEXT DROP 
  261. # 5d 1 7 
  262.       FOR i DUP 
  263. # 8d 2 \->LIST DOWL i 
  264. GET 1 3 SUB 1 \->GROB 
  265. PICT 3 ROLLD REPL 
  266. # 18d + 
  267.       NEXT DROP 
  268.     \>> 
  269.   CPSDT 
  270.     \<< 10000 / SWAP 
  271. IP + 100 / SWAP IP 
  272.     \>> 
  273.   EXPDT 
  274.     \<< DUP IP SWAP 
  275. FP 100 * DUP IP 
  276. SWAP FP 10000 * 
  277.     \>> 
  278.   JFIX 
  279.     \<< 
  280.       IF -42 FC? 
  281.       THEN 3 ROLLD 
  282. SWAP 3 ROLL 
  283.       END 
  284.     \>> 
  285.   day 19 
  286.   year 1990 
  287.   month 10 
  288.   PPAR { 
  289. (-6.5,-3.1) 
  290. (6.5,3.2) X 0 (0,0) 
  291. FUNCTION Y } 
  292. END 
  293.  
  294.